package JUC;

import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;

/**
 * @author ldy
 * @data 2022/12/9
 * @description
 */
public class ThreadBaseDemo {
    public static void main(String[] args) {


        Thread t1 = new Thread(() -> {
            System.out.println(Thread.currentThread().getName());
            System.out.println(Thread.currentThread().isDaemon() ? "守护线程" : "用户线程");
            while (true){}
        }, "t1");

        t1.start();
        t1.setDaemon(true);
        try {TimeUnit.SECONDS.sleep(3);} catch (InterruptedException e) {throw new RuntimeException(e);}
        System.out.println("主线程结束");

    }
}
